home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Supervisor's Toolkit
/
Network Supervisor's Toolkit.iso
/
logins
/
jb-learn
/
jb-learn.mac
< prev
next >
Wrap
Text File
|
1996-07-10
|
42KB
|
1,100 lines
JB-LEARN - Version 1.2 - Copyright (C) 1995, Jeff Bishop - February 4, 1995
Introduction
I have always loved writing {COMMO} macros. After examining other
telecommunication programs to see what could be added to {COMMO} I came
up with the idea of writing a automatic learn macro for {COMMO}.
The {COMMO} macro language is very complex. Many users have
been scared of it due to this fact. I thought to myself
"what could I do to make it easier". I decided to write a
macro that would create {COMMO} macros for login activities
(or any activity the user wishes). After weeks of work, JB
Learn was born to satisfy this requirement/need.
JB-Learn has the following features:
- A very solid learn engine to create ready-to-run macros
after learn mode is complete.
- A learn data file capacity to make future learning more
intelligent. The learn macro learns as you use it. This
is a first in the BBS community. Find another learn
engine that can do that (except CS-LEARN for {COMMO}).
The user has complete control as to what it learns.
- The learn data file will process {COMMO} variables for
you. This gives you even more power. This allows for great
flexibility when using CS-MAC since it defines a wealth of
variables that you can use.
- Have complete control of your learning experience. You
make the decisions if you want to. This provides the
ability to correct mistakes that the learn can not
handle. This provides the ability to create very solid
macros. Just think, you tell the teacher what to do and get a
better grade for it.
- Automatic detection of front end mailers. No need to
press <ESCAPE> twice any more (even during learning) as long as
EMSI protocol is being used.
- The learn can automatically try to log you in without
user intervention. This is similar to most other
conventional learn engines available in other
communication programs.
- The ability to add SSLOOK logic in your macros. This will make them
more stream lined for those nagging prompts often seen on BBS's.
Also added logic to allow for forwarding SSLOOKS after each
LOOKFOR/SEND combination. Define the SSLOOK once and use it over
and over again if need be.
- The macro is FREE for your use. The source code is very
well commented for a great learning experience.
Contact Information
I value all of your input. Please contact me with any
suggestions you may have. You can contact me via the following methods:
Jeff Bishop
Mailing Address: 420 E Yavapai RD. NO. H Tucson, AZ 85705
E-Mail Address : JBISHOP@PRIMENET.COM (my PGP public key in MYPUBLIC.KEY)
Voice Phone : 1-602-888-1456 (evenings before 12:00AM EST).
I can also be reached in the COMMO conference in the fidonet and WME
message networks. Post a message to "jeff bishop" and I will surely
respond to it.
Getting JB-Learn Updates
JB-Learn is distributed in two different packages. I am
distributing it as a stand alone package and it is also in the
CS-MAC package (version 13 and above). If you are reading this from
the CS-MAC archive, this may or may not be the latest one. Use the
information below to get the latest and greatest version.
If you have access to the internet, you can use ftp to get JB Learn.
Ftp to ftp.primenet.com. Login as anonymous and send your e-mail
address as the password. Once logged in, cd to /users/j/jbishop/commo.
Once here, get the file jbl-*.zip. This will get you the latest
version. You are also welcome to get the latest version of CS-MAC
here as well. Get the file cs*.zip.
If you wish, you can also ftp to ftp.nlbbs.com. Login as anonymous and
send your mail address as password. Once here, cd to /pub/cs-mac.
If you do not have access to the internet, you can log in to the
Demodulator BBS. The phone number is 1-602-290-2807. Use 'COMMO RELEASE'
as your first and last name. Use 'guest' as the password. A menu will
be presented to allow you to pick JB-Learn from.
==================================================
{:JB-LEARN}
This is the beginning of the macro. Here is where basic setup is done to
prepare for learn operation. Study this area carefuly and consult the
JB-LEARN.DOC file for further information about variables defined here.
{NOCARRIER QUIT}
Quit learn if carrier is lost.
{SETESCAPE-P0 ENT_LRN}{SETGET ,,L}
Define the label to go to when the <ESCAPE> key is pressed at the local
keyboard. Make all keyboard input echo to the local terminal only.
{SETVARIABLE AUTORESP,N}
This variable tells JB-LEARN whether or not to ask for confirmation of
each response found while reading the LEARN.DAT data file.
If it is set to 'Y', the macro will act in a true auto-learn mode.
{SETVARIABLE DATAFILE,%_HOM%learn.dat}
This defines the data filename used. The default is %_HOM%LEARN.DAT.
{SETVARIABLE ESCAPE_2,~^[~^[}
Define a variable as 2 escapes.
{SETVARIABLE CAPTFILE,%_HOM^(JBLRN^).CAP}
We are defining the name of the temporary capture file used throughout
this macro.
{SETVARIABLE FON_FILE,%_HOM^(JBLRN^).FON}
We are defining the name of the temporary FON file used throughout this
macro.
{SETVARIABLE NOV_MENU,Y}
Set JB-Learn menu in novice mode.
{SETVARIABLE SLKLIMIT,15}{DECREMENT SLKLIMIT,1}
This defines the number of SSLOOK strings allowed. A default of 15 is
defined. Change this to 0 if you do not want any SSLOOK logic in your
macros.
{SETVARIABLE SSLK_CNT,0}
Set the SSLOOK counter to 0.
{SETVARIABLE SSLKAUTO,N}
Set this variable to Y if you want SSLOOKS to be automatically generated
instead of LOOKFOR/SEND pairs. This is only going to happen in the area
that the data file is processed. It will not affect the JB-Learn menu.
{SETVARIABLE WAITTIME,10}
This variable defines the length of time after all modem
activity stops before the learn process starts interacting
with the user. The default is 10 seconds. Change the
definition if you would like. Be careful though to keep it
long enough. Making it too short will have disastrous
affects in the learn engine. If this variable is set as NULL,
then this auto learn type feature is turned off.
{CALL OPEN_CAP}
Open the capture file.
{:LEARNING}
This label begins the learning online process.
We are now going to define the learn robot.
{SETLOOK %WAITTIME}
This defines the setlook timer.
{GOLOOK LEARNING,^M}
The look timer is continuously reset upon seeing a <ENTER>
character. When it is seen, the macro jumps back to the LEARNING label.
{SSLOOK ESCAPE_2,**EMSI_}
Watch for the EMSI protocol string. When it comes in, send two escapes.
{LOOKFOR <ESC> FOR LEARN MODE}
Show a dummy lookfor and provide information to the user on the status line.
{:ENT_LRN}
Start parsing the BBS prompt now.
{CAPTURE N}{WOPEN-A %CAPTFILE}{WRITE}{WCLOSE}
Turn off the capture file. Open the capture file to write to (in append
mode). Write a blank line to the file to insure that the capture file
ends with a CR/LF pair. Close the capture file.
{RCLOSE}{ROPEN %CAPTFILE,ERD}{SETVARIABLE T}{SETVARIABLE LOOK_FOR}
Open the capture file for reading. Once the capture file has
been read completely, go to the label ERD. Clear the variables used
during the read loop below.
{:RDL}
Enter the capture file read loop to find the BBS prompt.
{READ T}{COMPARE T}{IFCONDITION RDL}
Read a line from the file. If the line is blank, go get another one.
{SETVARIABLE LOOK_FOR,%T}{GOTO RDL}
Set the LOOK_FOR variable to the line read and go get another line from
the file.
{:ERD}
End of file read label definition.
{COMPARE LOOK_FOR}{IFCONDITION ,JBLRNDAT}
We are checking to see if we have found a BBS prompt. If we
have, then control passes to parse the data file. Otherwise, we will now
ask the user to supply a look_for string (BBS prompt).
{CLEAR}{DISPLAY 1,1,,ENTER THE STRING TO LOOK FOR (BBS PROMPT): }
{GETSTRING-I LOOK_FOR,32}
Clear the screen and ask the user to supply a BBS prompt.
{COMPARE LOOK_FOR}{IFCONDITION QUIT}
See if the user entered a BBS prompt. If they did not, leave the learn
macro.
{:JBLRNDAT}
This is the label used to designate processing of the data file.
{SUBSTRING LOOK_FOR,-32,32,%LOOK_FOR}
Grab the last 32 characters of the BBS prompt as the target string.
{COMPARE LRN_MAC}{IFCONDITION ,LOAD_DAT}
If the macro file has already been defined process the data file.
We are now beginning to define the name of the macro file to write to
during learn operation.
{SETVARIABLE LRN_MAC,%_MAC}
We will first set the name of the macro file to the current {COMMO} macro
file name. The user may change it later.
{:DEF_MAC}
The macro entry loop.
{KEYSTUFF 4700}{INPUT LRN_MAC,ENTER MACRO FILE TO APPEND TO}
Stuff a HOME key into the keyboard buffer. This will force
the cursor at the beginning of the line of the input window. Allow the user
to edit the macro name if need be.
{COMPARE LRN_MAC}{IFCONDITION DEF_MAC}
Check and see if the macro is NULL. If it is, go back and re-enter it.
{:DEF_LBL}
We are now going to define the label to be used for this learned macro
entry.
{SETVARIABLE LRN_LBL,%_NAM}
{KEYSTUFF 4700}{INPUT LRN_LBL,ENTER LABEL NAME USED FOR THIS MACRO}
Stuff a HOME key into the keyboard buffer. This will force the cursor at
the beginning of the line of the input window. Allow the user to edit the
label name.
{COMPARE LRN_LBL}{IFCONDITION DEF_LBL}
Check and see if the label is NULL. If it is, go back and re-enter it.
This is the start of a routine to remove invalid characters from the label
name. The characters we will remove are the comma, space, colon, slash,
and curly braces
{SETVARIABLE I,, :/^(^)}{SETVARIABLE COUNT,0}{SETVARIABLE T}
This sets the invalid characters that will be stripped from the system name
to make the label name. Initialize a counter that will be used to step
through the system name character by character.
{:XLATE_LOOP}
This is the loop that checks each character and removes invalid
characters.
{INCREMENT COUNT,1}
Increment the placekeeper that checks each character in the system name.
{SUBSTRING CH,%COUNT,1,%LRN_LBL}
This takes a character out of the label name and puts it in variable %CH.
{COMPARE CH}{IFCONDITION XLATE_DONE}
This is checking for the end of the label name. If we have
reached the end, the variable %CH will be empty. If the variable %CH was
empty, we are done. Otherwise, continue to see if this is an invalid
character.
{INSTRING I,%CH}{IFCONDITION XLATE_LOOP}
Check to see if this character is in the invalid list. If it is in the
invalid list, loop back. If this character is not on the invalid list,
it will be added to the label.
{SETVARIABLE T,%T%%CH}
The act of sticking two variables back-to-back like this is called
"concatenating". Variable %LRN_LBL will keep growing until the end of the
system name is reached.
{LENGTH %T}{COMPARE _LEN,8}{IFCONDITION-E ,XLATE_LOOP}
This gets the length of the %LRN_LBL string and puts it into %_LEN The
length of the string is compared with the value "8". If the length of the
label = 8, the routine will go to the next step. If %_LEN does not = 8,
the routine will return to the top of the loop to get the next character.
{:XLATE_DONE}
Finish processing label definition.
{SETVARIABLE LRN_LBL,%T}{SETVARIABLE COUNT}{SETVARIABLE T}
{COMPARE LRN_LBL}{IFCONDITION DEF_LBL}
{INFORM-D1 THE LABEL BEING USED IS: %LRN_LBL ...}
Check and see if the label is NULL. If it is, go back and re-enter it.
{WOPEN-A %_HOM%%LRN_MAC}{WRITE}{WRITE ^(:%LRN_LBL^)}
Open the macro file and write a blank line to it. Write the label in the
macro file now.
{WRITE ^(SETVARIABLE ESCAPE_2,~^[~^[^)}
Write a variable definition to the macro as 2 escapes.
{WRITE ^(SSLOOK ESCAPE_2,**EMSI_^)}{WRITE}{WCLOSE}{INCREMENT SSLK_CNT,1}
Some BBS programs use a front end mailer. These front end mailers ask the
user to press <ESCAPE> twice to enter the BBS. This line automatically
senses these front end mailers and will send the <ESCAPE> characters for
you. After writing is done, close the file. Increment the SSLK_CNT
counter variable showing that a SSLOOK has been defined.
{CLEAR}{DISPLAY 1,1,,DO YOU WANT TO USE AUTO-LEARN MODE (Y/N) [N]? }
{GETSTRING-HI AUTORESP,1}{CLEAR}
Clear the screen. Ask the user if they want to use auto-learn mode.
The only way this feature is turned on is if AUTORESP is set to 'Y'.
{:LOAD_DAT}
Check and see if the BBS prompt has already been seen. If so, generate
the response automatically. Otherwise, begin loading the data file.
{COMPARE SLKLIMIT,0}{IFCONDITION-E LOADDAT1}{SETVARIABLE COUNT,0}
Initialize the counter to 0
{:CHK_SLOP}
{INCREMENT COUNT,1}
Increment the counter.
{COMPARE SLR_%COUNT}{IFCONDITION LOADDAT1}{SETVARIABLE-s RESP,SLR_%COUNT}
See if no response is available. If there is not one, end this routine.
{INSTRING SLT_%COUNT,%LOOK_FOR}{IFCONDITION ,CHK_SLOP}
Check and see if this target matches the BBS prompt found. If it does,
process it. If it is not, go get another SSLOOK variable.
{COMPARE SSLK_CNT,%SLKLIMIT}{IFCONDITION-L ,L_DAT2}
{:L_DAT1}
{WOPEN-A %_HOM%%LRN_MAC}{WRITE ^(SSLOOK SLR_%COUNT,%LOOK_FOR^)}{WRITE}
{WCLOSE}{INCREMENT SSLK_CNT,1}{GOTO L_DAT3}
{:L_DAT2}
{WOPEN-A %_HOM%%LRN_MAC}
{WRITE ^(LOOKFOR %LOOK_FOR^)}{WRITE ^(SEND %resp^)}{WRITE}{WCLOSE}
{call bringfwd}
{:L_DAT3}
{INFORM-D1 AUTOMATIC RESPONSE BEING GENERATED ...}{SEND %RESP}
{GOTO CLN_QUIT}
{:LOADDAT1}
{SETVARIABLE COUNT}{SETVARIABLE RESP}{SETVARIABLE T}
{IFEXIST %DATAFILE,OPENDATA}
If the data file does exist, process it. If it does not, ask the user
to supply the name of the data file.
{KEYSTUFF 4700}
Stuff a HOME key into the keyboard buffer. This will force
the cursor at the beginning of the line of the input window.
{INPUT DATAFILE,ENTER NAME OF LEARN DATA FILE (LEAVE BLANK TO IGNORE IT):}
Ask the user for the name of the data file.
{COMPARE DATAFILE}{IFCONDITION MENU}{IFEXIST %DATAFILE,,LOAD_DAT}
See if the variable is blank. If it is, jump to the learn menu. If it
is not, process the newly entered value again.
{:OPENDATA}
This is where the data file is opened.
{RCLOSE}{ROPEN %DATAFILE,DATA_EOF}
Open the data file for reading.
{:DAT_LOOP}
Here is where the data file loop begins.
{SETVARIABLE POS}{SETVARIABLE T}{SETVARIABLE RESPONSE}{SETVARIABLE TARGET}
Clear all variables used in the loop.
{READ T}{COMPARE T}{IFCONDITION DAT_LOOP}
Read a line from the DAT file.
{SUBSTRING POS,1,1,%T}{COMPARE POS, }{IFCONDITION DAT_LOOP}
Check to see if the line read is blank. If it is, go get another. Check
and see if the first character in the line is a space. If it is, get
another line.
{INSTRING T,,}{IFCONDITION ,DAT_LOOP}
Check and see if the line read as a target/response match. If it is not,
go get another.
{SETVARIABLE POS,%_POS}{INCREMENT POS,1}
Set the position found to POS. Increment the position variable by 1.
{SUBSTRING TARGET,%POS,255,%T}
Get the target string from the line read from the data file.
{COMPARE TARGET}{IFCONDITION DAT_LOOP}
Check and see if the target is blank. If it is, get another line from the
data file.
{INSTRING LOOK_FOR,%TARGET}{IFCONDITION ,DAT_LOOP}
Look to see if this defined target exists in the BBS prompt defined
earlier. Check and see if this target matches anything in the BBS prompt. If it does not, processing returns for another line
out of the data file.
{DECREMENT POS,2}{SUBSTRING RESPONSE,1,%POS,%T}
Decrement the position variable defined earlier by 2. Get the response
string from the data out of the data file.
{COMPARE RESPONSE}{IFCONDITION DAT_LOOP}{RCLOSE}
Close the data file.
{:DATA_EOF}
This label is the label used after the data file is closed.
{COMPARE RESPONSE}{IFCONDITION MENU}
See if the response is blank. If it is, jump to the learn menu.
{SUBSTRING T,1,1,%RESPONSE}
Look at the first character of the response.
{COMPARE T,%%}{IFCONDITION ,CONFGUES}
Is the first character of the response a "%"? Notice using two %'s in
order to represent a literal "%". If the first character of the RESPONSE
indicates that it is a {Commo} variable, we will proceed to translate the
variable into it's literal expression. For example, %NAME will be
converted to "Jeff Bishop". If the first character of the RESPONSE isn't a
"%", jump to the menu that asks you to confirm the response before sending
it. That menu is located at label :CONFGUES.
{SUBSTRING RESPONSE,2,200,%RESPONSE}
The first step in the translation is to strip off the leading "%"
character. Notice that this command substrings a variable back into itself.
{INSTRING RESPONSE,|}{IFCONDITION-C STRIP-PIPE}
The next step is to check the response variable for presence
of a "pipe" character. The macro assumes that the pipe would
only appear as the last character of a response. If the response
variable has a pipe character in it, we are going to call a routine to
strip it off. Otherwise, we will continue on our translation journey
directly. To make the IFCONDITION function perform a "call", the "-C"
switch is used. If we strip off the "pipe", we will add it back on
after performing the translation step.
{SETVARIABLE-S T,%RESPONSE}
This single step translates the variable name into the
contents of the variable name. Fred Brucker's explanation
in MACRO.DOC is very good (hint to read the docs).
Basically, this is a two step setvariable function. Step one
expands the %response to make this example command
Step 1 (setvariable t,%name) ;%t=name
Step 2 performs the above command ;%t=Jeff Bishop
{COMPARE T}{IFCONDITION-C N_VARDEF}
Now checking if you have %name (for example) defined. If
you haven't defined a variable in Commospace, %T will now
be NUL. This would be a disaster to the continuation
of the learn macro. If the response is NUL, we are going to call a
routine to ask you to define it. Otherwise, we will proceed with the
translation.
{SETVARIABLE RESPONSE,%T}
This command moves the contents of %T into %RESPONSE, and we are
assured that %T is not NUL ... therefore %RESPONSE is not NUL.
{COMPARE STRIPT}{IFCONDITION CONFGUES}
Now checking if we earlier made a trip to the routine that
strips off a trailing "pipe" character. If %stript is NUL,
it means we didn't make the trip to :STRIP-PIPE. If %stript is NUL,
meaning we didn't strip off a trailing "pipe", then jump to the routine
that asks you to confirm the response before it is sent. Translation is
complete. If %stript contains a value, it means that we DID make a trip
to the :STRIP-PIPE routine. If that is the case, our translation isn't
complete yet, we have to add the "pipe" back onto the response.
{SETVARIABLE RESPONSE,%RESPONSE|}{SETVARIABLE STRIPT}{GOTO CONFGUES}
This simply puts the "pipe" character back on the translated
variable (turning %name| into Jeff Bishop|). This clears the variable
that was used to indicate that we had made a call to :STRIP-PIPE.
Translation is complete. Go to the routine that asks you to
confirm the response before it is sent.
{:STRIP-PIPE}
This label is the start of a routine to remove a trailing "|"
from a variable. The command that happened just before coming
here was (instring response,|). We are here because the
answer to that was "YES", there IS a "pipe" in %RESPONSE.
{SETVARIABLE LEN,%_POS}
This puts the position of the "|" (given by the instring
function as %_pos) into %len. Commo does not provide for
tampering with the %_pos variable.
{DECREMENT LEN,1}{SETVARIABLE STRIPT,Y}{RETURN}
{SUBSTRING RESPONSE,1,%LEN,%RESPONSE}
These two commands strip the last character from the
%RESPONSE variable, in this case we have stripped a "|". This sets a
variable that we will later use to replace the character that we stripped
off with this routine. This is the end of the :STRIP-PIPE subroutine.
Return to the place called from.
{:N_VARDEF}
This label is the start of a routine that prompts you for a
setting for a variable. This routine is called when a
variable appears in the LEARN.DAT file and that variable
isn't found in the currently defined Commo variables.
Typically, these variables would be %name and %_pas.
{CLEAR}{DISPLAY 1,1,,Input a value for %%%response: }
The first two % signs cause a % to be displayed. The third
one causes %response to be displayed as its value.
An example result .... "Input a value for %name: "
{GETSTRING-I %%RESPONSE}
This simple looking command is a very powerful command.
Notice that there are two % signs. This means, in this
example, that we are getting a value for %name. The "-I"
switch restricts input to the keyboard, if the host system
sends anything, it will be ignored.
{COMPARE %%RESPONSE}{IFCONDITION N_VARDEF}
Checking to make sure that you have put a value in for this
variable. Have you a value for %name? If %%response (in example, %name)
is NUL, repeat the routine until you put in a value.
{SETVARIABLE-S T,%RESPONSE}{RETURN}
This is similar to the command that was used in the primary
translation routine. By example, it first "expands" %response
to %name, then it sets %T=contents of %name. This is the end of the
routine that asks you to define a variable. This label marks the end of
reading the data file and making any necessary variable translations.
{:CONFGUES}
This is the start of a menu that asks you to confirm your response to
this BBS prompt.
{COMPARE AUTORESP,Y}{IFCONDITION RITERESP}
See if the user does not want to get prompted.
{CLEAR}{DISPLAY 1,1,,BBS PROMPT: %LOOK_FOR}
Clear the screen and show the BBS prompt.
{COMPARE RESPONSE,%_PAS|}{IFCONDITION ,C_GUESS1}
{DISPLAY 2,1,,RESPONSE STRING : ^(PASSWORD^)}{GOTO GUESSCHK}
{:C_GUESS1}
{DISPLAY 2,1,,RESPONSE STRING : %RESPONSE}
{:GUESSCHK}
{DISPLAY 4,1,,IS THIS RESPONSE CORRECT (Y/N) [N]? }
Display the response and target strings and ask if the
response is correct.
{GETSTRING-HI KEY,1,MENU}
Get keyboard input. If the user presses <ENTER> controls passes to the
learn menu.
{COMPARE KEY,Y}{IFCONDITION ,MENU}
If the user presses N control will pass to the learn menu.
{COMPARE SSLK_CNT,%SLKLIMIT}{IFCONDITION-L ,RITERESP}
{COMPARE SSLKAUTO,Y}{IFCONDITION RITESSLK}
See if the SSLOOK count is less than SLKLIMIT. If it is, continue. If it
is not, bypass SSLOOK logic.
{CLEAR}
{DISPLAY 1,1,,DEFINE THIS AS A SSLOOK STRING COMBINATION (Y/N) [N]? }
{GETSTRING-HI KEY,1,RITERESP}
Get keyboard input. If the user presses <ENTER> controls passes to the
normal LOOKFOR/SEND macro method.
{COMPARE KEY,Y}{IFCONDITION ,RITERESP}
If the user presses N control will pass to the LOOKFOR/SEND macro logic.
{:RITESSLK}
{INCREMENT SSLK_CNT,1}
Increment the SSLOOK counter.
{SETVARIABLE SLR_%SSLK_CNT,%RESPONSE}
{SETVARIABLE SLT_%SSLK_CNT,%LOOK_FOR}
Build the SSLOOK strings.
{WOPEN-A %_HOM%%LRN_MAC}{WRITE ^(SETVARIABLE SLR_%SSLK_CNT,%RESPONSE^)}
{WRITE ^(SSLOOK SLR_%SSLK_CNT,%LOOK_FOR^)}{WRITE}{WCLOSE}{CLEAR}
{DISPLAY 1,1,,BRING THIS SSLOOK STRING COMBO FORWARD AFTER ALL LOOKFOR/SEND PAIRS (Y/N) [N]? }
{GETSTRING-HI KEY,1}{SETVARIABLE SLF_%SSLK_CNT,%KEY}{GOTO RITEDONE}
Write the variable definition and the SSLOOK to the macro file. Continue
macro execution.
{:RITERESP}
{WOPEN-A %_HOM%%LRN_MAC}{WRITE ^(LOOKFOR %LOOK_FOR^)}
{WRITE ^(SEND %RESPONSE^)}{WRITE}{WCLOSE}{call bringfwd}
Open the macro file. Write the commands to it. After doing
so, close the macro file. Reset the SSLOOK counter to 0.
{:RITEDONE}
{COMPARE T,%%_PAS}{IFCONDITION ,GUES_END}
{PASSWORD}{SEND |}{GOTO CLN_QUIT}
{:GUES_END}
{SEND %RESPONSE}{GOTO CLN_QUIT}
Send the response string now. Clean up now.
{:MENU}
This label begins the learn menu.
{CLEAR}{COMPARE NOV_MENU,Y}{IFCONDITION ,MENU1}
{DISPLAY 1,1,,JB-LEARN RESPONSE TYPE MENU - VERSION 1.2}
{DISPLAY 2,1,,BBS PROMPT: %LOOK_FOR}
{DISPLAY 4,1,,C - CONTINUE LEARNING}
{DISPLAY 6,1,,E - SEND <ENTER>}
{DISPLAY 8,1,,H - TREAT AS A SINGLE KEY HOT KEY (NO <CR>)}
{DISPLAY 10,1,,I - INSERT COMMENT INTO MACRO}
{DISPLAY 12,1,,L - TREAT AS A SSLOOK STRING: (SSLOOK COUNT %SSLK_CNT)}
{DISPLAY 14,1,,P - TREAT AS A PASSWORD}
{DISPLAY 16,1,,Q - QUIT JB-LEARN}
{DISPLAY 18,1,,R - REVISE/EDIT BBS PROMPT}
{DISPLAY 20,1,,S - ENTER STANDARD BBS RESPONSE (WITH <CR>)}
{DISPLAY 22,1,,W - SET WAIT TIME: %WAITTIME}
{DISPLAY 23,1,,X - TOGGLE BETWEEN NOVICE AND EXPERT MENU}
{DISPLAY 24,1,,ENTER CHOICE: C,E,H,I,L,P,Q,R,S,W,X: }{GOTO MENU2}
Clear the screen and display the menu.
{:MENU1}
{DISPLAY 1,1,,ENTER CHOICE: C,E,H,I,L,P,Q,R,S,W,X: }
{:MENU2}
{GETSTRING-HI KEY,1,MENU}
Prompt for keyboard input. If <ENTER> is pressed by itself,
control passes to the label shown at the end of the line.
{COMPARE KEY,C}{IFCONDITION CLN_QUIT}
{COMPARE KEY,E}{IFCONDITION JBL_SNCR}
{COMPARE KEY,H}{IFCONDITION JBL_HKEY}
{COMPARE KEY,I}{IFCONDITION INS_CMNT}
{COMPARE KEY,L}{IFCONDITION ,MENU3}
{COMPARE SSLK_CNT,%SLKLIMIT}{IFCONDITION-L D_SSLOOK,MENU}
{:MENU3}
{COMPARE KEY,P}{IFCONDITION JBL_PASS}
{COMPARE KEY,Q}{IFCONDITION QUIT}
{COMPARE KEY,R}{IFCONDITION EDITBPMT}
{COMPARE KEY,S}{IFCONDITION JBL_STD}
{COMPARE KEY,W}{IFCONDITION WAITTIME}
{COMPARE KEY,X}{IFCONDITION ,MENU}
{COMPARE NOV_MENU,Y}{IFCONDITION MENU4}{SETVARIABLE NOV_MENU,Y}{GOTO MENU}
{:MENU4}
{SETVARIABLE NOV_MENU,N}
Check for each option on the menu to see if the user
selected it and branch accordingly.
{GOTO MENU}
None of the options matched the key pressed, re-display the
menu.
{:JBL_SNCR}
Send <ENTER> label.
{WOPEN-A %_HOM%%LRN_MAC}
{WRITE ^(LOOKFOR %LOOK_FOR^)}{WRITE ^(SEND |^)}{WRITE}{WCLOSE}
{call bringfwd}{SEND |}{SETVARIABLE RESPONSE,|}{GOTO CLEAN_UP}
Open the macro file. Write the command to look for the BBS
prompt followed by a command to send the <ENTER> key. The
file is then closed. Send the <ENTER> out to the BBS now and clean up
after that.
{:JBL_HKEY}
Process hot key entries.
{CLEAR}{DISPLAY 1,1,,ENTER THE KEY TO SEND TO THE HOST: }
Clear the screen and prompt the user for a key.
{GETSTRING-HI KEY,1,MENU}
Get keyboard input. If the user presses <ENTER>, then
control passes back to the main learn menu.
{WOPEN-A %_HOM%%LRN_MAC}
{WRITE ^(LOOKFOR %LOOK_FOR^)}{WRITE ^(SEND %KEY^)}{WRITE}{WCLOSE}
Open the macro file and write the two commands to the file.
Close the file.
{SEND %KEY}{SETVARIABLE RESPONSE,%KEY}{call bringfwd}{GOTO CLEAN_UP}
Send the key to the BBS and clean up after it.
{:INS_CMNT}
Insert comment into macro file.
{INPUT T,ENTER A COMMENT TO PLACE INTO THE MACRO FILE: }
Prompt the user for a comment.
{WOPEN-A %_HOM%%LRN_MAC}{WRITE}{WRITE %T}{WRITE}{WCLOSE}
Open the macro file and write the comment to the file.
Close the file.
{SETVARIABLE T}{GOTO CLN_QUIT}
{:D_SSLOOK}
Define a SSLOOK definition for the macro.
{SETVARIABLE RESPONSE}{INPUT RESPONSE,ENTER THE STRING TO SEND TO THE HOST}
Ask the user to enter a string.
{CLEAR}{DISPLAY 1,1,,DO YOU WANT A <CR> SENT WITH THIS STRING (Y/N) [N]? }
{GETSTRING-HI CH,1,SSLKCONT}
Ask the user if he/she would like to have a <CR> attached to the entered
string.
{COMPARE CH,Y}{IFCONDITION ,SSLKCONT}
Check and see if the answer is 'Y'. If it is not, skip adding the <CR>.
{SETVARIABLE RESPONSE,%RESPONSE|}
Add the <CR> to the response.
{:SSLKCONT}
{COMPARE RESPONSE}{IFCONDITION ,SSLKCON1}
If the user enters no data, return to the menu.
{INFORM-D1 NO RESPONSE ENTERED - RETURNING TO LEARN MENU ...}{GOTO MENU}
{:SSLKCON1}
{INCREMENT SSLK_CNT,1}
Increment the SSLOOK counter.
{SETVARIABLE SLR_%SSLK_CNT,%RESPONSE}
{SETVARIABLE SLT_%SSLK_CNT,%LOOK_FOR}
Build the SSLOOK strings.
{WOPEN-A %_HOM%%LRN_MAC}{WRITE ^(SETVARIABLE SLR_%SSLK_CNT,%RESPONSE^)}
{WRITE ^(SSLOOK SLR_%SSLK_CNT,%look_for^)}{WRITE}{WCLOSE}{CLEAR}
{DISPLAY 1,1,,BRING THIS SSLOOK STRING COMBO FORWARD AFTER ALL LOOKFOR/SEND PAIRS (Y/N) [N]? }
{GETSTRING-HI KEY,1}{SETVARIABLE SLF_%SSLK_CNT,%KEY}
Write the variable definition and the SSLOOK to the macro file.
{SEND %RESPONSE}{SETVARIABLE CH}{SETVARIABLE RESPONSE}{CLEAR}{GOTO CLN_QUIT}
Send the string to the system and clear variables. Begin learning again
after doing that.
{:JBL_PASS}
Process as a password.
{COMPARE _PAS}{IFCONDITION ,PASS1}
Check and see if the password has been defined from the dialing directory.
If it has, jump to the label shown. Otherwise, we need to enter one.
{CLEAR}{DISPLAY 1,1,,ENTER YOUR PASSWORD: }
Clear the screen and prompt the user for a password.
{GETSTRING-IP RESPONSE,,MENU}
Get keyboard input. If the user just presses <ENTER>, then
control passes back to the menu.
{SETVARIABLE T,^(SEND %RESPONSE|^)}{GOTO JBL_PCNT}
Jump to this label.
{:PASS1}
Set password from dialing directory.
{SETVARIABLE T,^(PASSWORD^) ^(SEND |^)}
{:JBL_PCNT}
Process password in macro file and send it out to the BBS.
{WOPEN-A %_HOM%%LRN_MAC}{WRITE ^(LOOKFOR %LOOK_FOR^)}{WRITE %T}{WRITE}
{WCLOSE}
Open the macro file. Write the command strings to the macro. Close the
macro file.
{call bringfwd}{COMPARE _PAS}{IFCONDITION JBLPCNT2}{PASSWORD}{SEND |}
{GOTO CLN_QUIT}
{:JBLPCNT2}
{SEND %RESPONSE|}{GOTO CLN_QUIT}
Send the password out to the BBS. Clean up after it.
{:JBL_STD}
Process standard BBS response (with <ENTER> at end).
{SETVARIABLE RESPONSE}{INPUT RESPONSE,ENTER THE STRING TO SEND TO THE HOST}
Ask the user to enter a string.
{COMPARE RESPONSE}{IFCONDITION MENU}
If the user enters no data, return to the menu.
{setvariable response,%response|}
Add a <CR> to the response.
{WOPEN-A %_HOM%%LRN_MAC}
{WRITE ^(LOOKFOR %LOOK_FOR^)}{WRITE ^(SEND %RESPONSE^)}{WRITE}{WCLOSE}
Open the macro file. Write the command strings to it and close the macro
file.
{call bringfwd}{SEND %RESPONSE}{GOTO CLEAN_UP}
Send the entered string to the BBS. Clean up now.
{:EDITBPMT}
Edit BBS prompt.
{KEYSTUFF 4700}{INPUT LOOK_FOR,ENTER/EDIT THE BBS PROMPT}
Stuff a HOME key into the keyboard buffer. This will force
the cursor at the beginning of the line of the input window. Allow the user
to edit the BBS prompt found.
{COMPARE LOOK_FOR}{IFCONDITION QUIT}{GOTO MENU}
If the BBS prompt is blank, leave JB-learn macro. Return to the menu.
{:OPEN_CAP}
Open capture file.
{EXECUTE-N IF EXIST %CAPTFILE DEL %CAPTFILE>NUL}
Check and see if the capture file exists. If it does, delete it.
{CAPMODE FILTER}{CAPTURE Y,%CAPTFILE}{RETURN}
Set the capture mode to filter. Open the capture file and return.
{:WAITTIME}
Wait timeout entry.
{KEYSTUFF 4700}
Stuff a HOME key into the keyboard buffer. This will force
the cursor at the beginning of the line of the input window.
{INPUT WAITTIME,ENTER THE NUMBER OF SECONDS TO WAIT UNTIL MENU?}{GOTO MENU}
{:CLEAN_UP}
The clean up routine.
{SETVARIABLE KEY}{CLEAR}
{DISPLAY 1,1,,ADD THIS RESPONSE/TARGET COMBO TO THE DATA FILE (Y/N) [N]? }
Clear the screen and ask the user if he/she would like to add this
response/target to the data file.
{getstring-hi key,1,CLN_QUIT}
Get keyboard input
{compare key,Y}{ifcondition ,cln_quit}
If the user answers Y the append will happen. If they do not the quit will
continue without writing to the data file.
{WOPEN-A %DATAFILE}{WRITE %RESPONSE,%LOOK_FOR}{WCLOSE}
Write the new response/BBS prompt combination to the data file.
{:CLN_QUIT}
{CALL OPEN_CAP}{GOTO LEARNING}
Open the capture file and return to learn mode.
{:ADD_FON}
Add dialing directory entry to dialing directory for new learn macro.
{CLEAR}{DISPLAY 1,1,,ADD A NEW ENTRY TO YOUR DIALING DIRECTORY (Y/N) [N]? }
{GETSTRING-HI KEY,1}
Ask the user if they would like to add a new dialing directory entry.
{COMPARE KEY,Y}{IFCONDITION ,RETURN}
Check and see if the user wishes to do this. If not, quit the adding
routine.
{SETVARIABLE CH,%_NAM}
Set the variable to the system name (if known) by COMMO.
{COMPARE CH}{IFCONDITION ,GETNAM1}
See if the system name is known now.
{SETVARIABLE CH,%LRN_LBL}
Set the system name to the value defined for the label in the macro file
written during learn mode.
{:GETNAM1}
{KEYSTUFF 4700}
Stuff a HOME key into the keyboard buffer. This will force
the cursor at the beginning of the line of the input window.
{INPUT CH,ENTER THE SYSTEM NAME FOR YOUR DIALING DIRECTORY ENTRY: }
Make the user verify their system name before continuing
{COMPARE CH}{IFCONDITION RETURN}
See if the user left the system name blank. If he/she did then exit add.
{SETVARIABLE F,%CH (WITH LEARN) %_MON/%_DAY/%_YEA ^(}
Start building the dialing directory entry string here.
{:GETNUM0}
This label denotes the beginning of processing the phone number to be
dialed.
{SETVARIABLE T,%_NUM}
Set the variable to the value known by COMMO's internal variable.
{KEYSTUFF 4700}{INPUT T,ENTER THE SYSTEM'S PHONE NUMBER: }
Stuff a HOME key into the keyboard buffer. This will force the cursor at
the beginning of the line of the input window. Ask the user to confirm the
phone number.
{COMPARE T}{IFCONDITION GETNUM0}
If the phone number is blank (or edited blank), ask for the number again.
{SETVARIABLE F,%F%%T^) ^(}
Continue building the dialing directory entry string.
{:GETPAS0}
We are now going to process the password.
{COMPARE _PAS}{IFCONDITION GETPAS1}
See if the password is defined from a linked dialing directory entry.
If it is not, we will get a password from the user.
{SETVARIABLE F,%F%%_PAS^) ^(}{GOTO ADD_MACRO}
Add the password to the dialing directory entry since we know the
password. Jump to process the macro piece of the dialing directory entry.
{:GETPAS1}
This label begins asking the user for a password.
{CLEAR}{DISPLAY 1,1,,ENTER YOUR PASSWORD USED ON THIS SYSTEM: }
Clear the screen and prompt the user for a password.
{GETSTRING-IP T}{CLEAR}
Get the password from the user.
{SETVARIABLE F,%F%%T^) ^(}
Add the password to the dialing directory entry.
{:ADD_MACRO}
This label starts the preparation and completion of writing to the dialing
directory.
{SETVARIABLE F,%F%%LRN_LBL,%LRN_MAC^) ^(^)}
Complete the dialing directory entry string here.
{EXECUTE-S COPY %_HOM%%_FON %FON_FILE>NUL}
Make a copy of your dialing directory.
{IFEXIST %FON_FILE,,RETURN}
Check and see if the copy was done correctly. If it was not, end the
routine.
{RCLOSE}{ROPEN %FON_file,FON_FIN0}{WOPEN %_HOM%%_FON}
Open the COMMO dialing directory and the temporary file to write to here.
{SETVARIABLE COUNT,0}
Reset the counter to 0.
{:ADD_RWL}
Here is where the read loop begins.
{READ T}{WRITE %T}
Read a line from the dialing directory and write it out to the temporary
file.
{COMPARE COUNT,1}{IFCONDITION-E ADD_RWL}
Check and see if we have already written a line to the temporary for the
new entry. If so, just keep reading and writing.
{INSTRING T,%CH}{IFCONDITION ,ADD_RWL}
Check and see if the line read is our system name. If it is not, go get
another.
{INCREMENT COUNT,1}{WRITE %F}{GOTO ADD_RWL}
Increment the counter. Write the new dialing directory entry and go get
another line.
{:FON_FIN0}
This label is jumped to when the last line is read from .FON directory.
{COMPARE COUNT,1}{IFCONDITION-E ADD_END}{WRITE %F}
See if we have already written the newly created dialing directory entry.
If we have, skip to the label shown. Write the new dialing directory entry.
{:ADD_END}
{WCLOSE}
Close the file.
{SETR FON_ERR}{FONFILE %_FON}{SETR}{RETURN}
Re-load the dialing directory. If this is not a registered version of
{COMMO} use the EXECUTE function method.
{:FON_ERR}
Since this is not a registered version of {COMMO}, reload the dialing
directory by swapping to DOS and come right back.
{EXECUTE-S VER>NUL}{SETR}{RETURN}
{:QUIT}
Quit routine.
{NOCARRIER}{EXECUTE-N IF EXIST %CAPTFILE DEL %CAPTFILE>NUL}
Reset the NOCARRIER macro function. Check and see if the capture file
exists. If it does, delete it.
{COMPARE LRN_MAC}{IFCONDITION Q_RESET}{IFEXIST %_HOM%%LRN_MAC,,q_reset}
If no macro has been started, jump to the end of the quit routine.
{COMPARE LOOK_FOR}{IFCONDITION QUIT1}
Look and see if we have a BBS prompt available.
{WOPEN-A %_HOM%%LRN_MAC}{WRITE ^(LOOKFOR %LOOK_FOR^)}{WRITE}{WCLOSE}
Write one last LOOKFOR for the ending BBS prompt if one exists.
{:QUIT1}
CLEAR SSLOOK VARIABLES OUT OF {COMMO} VARIABLE SPACE.
{SETVARIABLE COUNT,0}
Clear variables and get counter ready for loop below.
{:SSLKLOOP}
This is the loop that will clear those variables defined during the
learn. Clearing commands will also be written to the macro file.
{INCREMENT COUNT,1}{COMPARE SLR_%COUNT}{IFCONDITION END_MACR}
Increment the SSLOOK counter.
{WOPEN-A %_HOM%%LRN_MAC}{WRITE ^(SETVARIABLE SLR_%COUNT^)}{WCLOSE}
Open the macro file and write code to clear this variable out.
{SETVARIABLE SLF_%COUNT}{SETVARIABLE SLR_%COUNT}{SETVARIABLE SLT_%COUNT}
{GOTO SSLKLOOP}
Clear this variable and go get another one if it is available.
{:END_MACR}
{WOPEN-A %_HOM%%LRN_MAC}{WRITE ^(SETVARIABLE ESCAPE_2^)}
{WRITE ^(INFORM-D1 LOGIN COMPLETE ...^) ^(STOP^)}{WCLOSE}
Open the macro file. Write the ending commands to the macro file.
Close the macro file.
{:Q_RESET}
{CALL ADD_FON}{CLEAR}
Add an entry to your dialing directory for this learn macro script just
created.
Reset all variables used during learn operation.
{SETVARIABLE CAPTFILE}{SETVARIABLE DATAFILE}{SETVARIABLE LRN_MAC}
{SETVARIABLE FON_FILE}{SETVARIABLE LRN_LBL}{SETVARIABLE WAITTIME}
{SETVARIABLE KEY}{SETVARIABLE COUNT}{SETVARIABLE POS}{SETVARIABLE T}
{SETVARIABLE ESCAPE_2}{SETVARIABLE I}{SETVARIABLE CH}{SETVARIABLE AUTORESP}
{SETVARIABLE LOOK_FOR}{SETVARIABLE RESPONSE}{SETVARIABLE TARGET}
{SETVARIABLE F}{SETVARIABLE NOV_MENU}{SETVARIABLE SLKLIMIT}
{SETVARIABLE SSLKAUTO}{SETVARIABLE SSLK_CNT}
{INFORM-D1 JB-LEARN VERSION 1.2 IS COMPLETE ...}{UNLO}
Inform the user that processing is complete and stop macro execution.
{:BRINGFWD}
This routine will bring forward those SSLOOK definitions desired after
writing the LOOKFOR/SEND combination.
{SETVARIABLE SSLK_CNT,0}{SETVARIABLE COUNT,0}{SETVARIABLE T}
Clear out variables used in this routine.
{:fwd_loop}
Begin the forward loop.
{COMPARE SSLK_CNT,%SLKLIMIT}{IFCONDITION-L ,END_FWD}
See if we have reached the SSLOOK limit. If so, quit now.
{INCREMENT COUNT,1}
Increment the counter.
{COMPARE SLR_%COUNT}{IFCONDITION END_FWD}
See if there is a response string defined here. If not, quit.
{COMPARE SLF_%COUNT,Y}{IFCONDITION ,FWD_LOOP}
See if this SSLOOK combination is coming forward. If it is not, loop
back for another.
{SETVARIABLE-S T,SLT_%COUNT}
{WOPEN-A %_HOM%%LRN_MAC}{WRITE ^(SSLOOK SLR_%COUNT,%T^)}{WRITE}{WCLOSE}
Write the data to the macro file.
{INCREMENT SSLK_CNT,1}{GOTO FWD_LOOP}
Increment the SSLOOK counter and go back for another one.
{:END_FWD}
{SETVARIABLE T}{SETVARIABLE COUNT}
Clear the variables used in this routine. Return to the calling routine.
{:RETURN}
A very useful macro label to cause a return.
{RETURN}